package com.twu.biblioteca.command;

import com.twu.biblioteca.db.MovieStore;
import com.twu.biblioteca.utilities.ConsoleReader;
import com.twu.biblioteca.utilities.MessagePrinter;

public class CheckoutMovieCommand implements Command {
    MovieStore movieStore;
    MessagePrinter printer;
    ConsoleReader reader;

    public CheckoutMovieCommand(MovieStore movieStore, MessagePrinter printer, ConsoleReader reader) {
        this.movieStore = movieStore;
        this.printer = printer;
        this.reader = reader;
    }

    @Override
    public void execute() {
        if(movieStore.checkout(reader.readIdFromConsole("Movie")))
            printer.printSuccessCheckoutMessage("Movie");
        else
            printer.printErrorCheckoutMessage("Movie");
    }
}
